home *** CD-ROM | disk | FTP | other *** search
/ Logiciels PC Special 5 / Logiciels PC HS 5.iso / Logs / Lego / L2p / L2P.DOC < prev    next >
Encoding:
Text File  |  1999-01-06  |  13.3 KB  |  380 lines

  1. l2p.doc for Version 0.51
  2.  
  3. 1. General
  4.  
  5. 1.0. DISCLAIMER
  6.  
  7.   LEGO(tm) is a trademark of The LEGO Group (TLG).  I am not related to TLG
  8. in any way. POV-Ray(tm) is a trademark of the POV-Ray Team (tm).
  9.  
  10.  
  11. 1.1. What is l2p ?
  12.  
  13.   l2p is a converter from James Jessimans LDraw to POV-Ray.  Models created
  14. with LDraw can be nicely rendered by POV-Ray when converted with l2p.
  15.   l2p is (C) by Lutz Uhlmann 1997,1998.
  16.  
  17.  
  18. 1.2. What do I need to run l2p ?
  19.  
  20.   Of course  you need the LDraw package to create the models.  This package
  21. is not  included,  the  most  recent  version is  available for download at
  22. James's  homepage,  "http://silo.riv.csu.edu.au:80/~jjessiman/lego/ldraw/".
  23. To run LDraw, you need DOS or a DOS emulating environment. 
  24.   Also  you need POV-Ray 3.0,  which is  available for various platforms at
  25. "http://www.povray.org".
  26.   At last  you need the  "lgeo" package  for POV-Ray.  "lgeo" is an acronym
  27. for  "Lego Geomtrical Equivalent Objects",  this  package  defines LEGO(tm)
  28. compatible objects and colors for POV-Ray.  All objects have are orientated
  29. the same as in LDraw, because it was mainly desgined to work with l2p.
  30.  
  31.  
  32. 1.3. What should the l2p package contain ?
  33.  
  34.   This package contains at least nine files:
  35.     go32.exe
  36.         l2p
  37.     l2p.exe
  38.     l2p.doc
  39.     l2p_colr.tab
  40.     l2p_elmt.tab
  41.         l2p_ptrn.tab
  42.     light.dat
  43.         spotlite.dat
  44.   l2p.exe  is a  Win32 console  application version,  which should  work on
  45. Win 95,  Win 98 and Win NT 4.0. L2p.doc is the one you read,  l2p_colr.tab,
  46. l2p_elmt.tab  and l2p_ptrb.tab are  table files specifying  the LDraw parts
  47. and  colors supported  by my lgeo package.  They are  essential  for l2p to
  48. operate.  Any part or color not found in these files will not be converted.
  49. l2p  is the  Linux ELF Binary.  Light.dat and  the spotlite.dat  are  light
  50. sources to be used in Ledit to place lights. So copy these to files to your
  51. LDRAW\PARTS directory and try around. The spotlite has an arrow to indicate
  52. the direction of the light, so try some rotations.
  53.  
  54.  
  55. 2. How to run l2p
  56.  
  57. 2.1. Location of files
  58.  
  59.   The only files  needed are l2p_colr.tab,  l2p_elmt.tab  and l2p_ptrn.tab.
  60. They must be located in the directory from which l2p is called.  I just put
  61. all the l2p-files in my LDraw directory.
  62.  
  63.  
  64. 2.2. Calling l2p
  65.  
  66.   l2p  is called  via command line  "l2p [options] <source> <destination>".
  67. By default, if not given, a ".pov" suffix is added to the destination.  The
  68. options accepted by l2p are:
  69.   -f    Generate a full scene with a camera
  70.   -h    display help.
  71.   -i    Suffix '.inc' for generated files.
  72.   -l    Convert LDRAW Object "light.dat" to lightsources.
  73.   -t    Print a table of used parts (converted ones only)
  74.   -v    Verbose, print information about piece counts etc.
  75.   -s[n] Generate scene for each step.
  76.         If n is given, generate file only for step n
  77.  
  78.   Each generated  file will  contain the required #include diectives to in-
  79. clude the parts and colors from  the lgeo package to render the  model. You
  80. just have to set up a camera and perhaps some additional lights.  Of course
  81. you can modify the scene file to your like, perhaps include some fog, halos
  82. or anything you want.
  83.  
  84.   New for version 0.2 is the submodel feature. For each part which does not
  85. apply to the standard part names,  beginning with a number, a #include line
  86. will be generated. The whole included file will be bound to one object by a
  87. union or merge  command and textured with the color given.  So if there are
  88. any parts in the included model with color 16, they will be colored in this
  89. color, like in LDraw. Color 24 is not supported. Of course you will have to
  90. convert the included models themselves, with the -i switch set to generate
  91. ".inc" suffixed files.
  92.   There are two example files, "test_inc.dat" (submodel) and "inc_test.dat"
  93. zipped for download iavailable at my homepage.  Main file is "inc_test.dat"   
  94. which places three of the submodels in  different partial colors on a green
  95. baseplate.  Check these files  to get the  idea how this works.  I have not 
  96. tested it, but it should also work recursively,  with submodels in the sub-
  97. model. I also am not sure how the results for transparent colored submodels
  98. will be,  as I can not determine which color will be used if a part is used
  99. with color number 16. In this case, the whole submodel is merged instead of
  100. using a union.    
  101.   Another problem may occur with people making their own parts,  and naming
  102. them.  They may be misinterpreted as a LDraw part when the names first char
  103. is a digit (0-9) and not will not converted at all,  or otherwise they will
  104. be interpreted as a submodel,  which is not available,  because it is not a
  105. real submodel.  I have to set a break here,  so l2p will support only parts
  106. with official LEGO(tm) parts numbers, or 'unknown' numbers given to them by
  107. James Jessiman, the author of LDraw.  All parts not apllying to this rules
  108. may be misinterpreted, until I rewrite l2p from scratch (maybe never). 
  109.   New for version 0.3 is the ability to work with moved part numbers. So if
  110. you still use for example part 9 (1x8 plate) in your model, which has moved
  111. to 3460, l2p will count and include this part as 3460.  So do not be afraid
  112. when you use L2P with the -t table option get some part numbers you did not
  113. use in your model.  The parts moved  are deleted from the LGEO Library with
  114. their old numbers and only  used with the new numbers.  You should not need
  115. to worry about  your older models,  but for the  future better  use the new
  116. numbers.
  117.   New for version 0.31 is the ability of generating a printout of parts not
  118. in the LGEO Library yet. Use the "-m" option to see the missing parts.
  119.   New for version 0.4 are patterned parts.  Therefore, a new data file with
  120. the actually implemented patterns called "l2p_ptrn.tab" is needed.  Because
  121. of the  limitations to a 8.3  file name,  the patterns have a file name not
  122. matching the pattern name.  The pattern include files for POV-Ray are to be
  123. located is the "patterns" subdirectory in your LGEO directory. If a pattern
  124. is not available, an undecorated version of the part is used, if available.
  125.   New for Version 0.5 is the camera  generating feature using the "-f" com-
  126. mand line switch. Read section 2.2.7. for details. 
  127.   Version 0.51 fixes  some minor bug  in the default  camera generating and 
  128. adds the feature of directed lights.
  129.   Version 0.52 fixes a bug  with submodels in submodels using color 16, re-
  130. ported by Jacob Sparre Anderson.  L2P also does  not give  a table with the
  131. stupid %NaN number when processing a file completely using submodels and no
  132. real parts.
  133.   Version 0.53 adds the feature for  multiple used part number or subparts,
  134. like 3709 (Technic Plate 2x4) and 3709a (Brick 2 x 4 with holes)  as an ex-
  135. ample for multiple parts and 89 (Technic Universal Joint),  which has to be
  136. used separately  with 89a and 89b if a specific  angle is needed as example
  137. for subparts.
  138.  
  139.  
  140. 2.2.1. -i command line switch
  141.  
  142.   If "-i" or "-I" is  specified in the command line,  instead of the ".pov"
  143. suffix,  a ".inc" suffix is added to the  destination file name.  Note that
  144. even "l2p -i mymodel.dat mymodel.pov" will generate a file "mymodel.inc".
  145.  
  146.  
  147. 2.2.2. -l command line switch
  148.  
  149.   If  you  specify  "-l" or "-L" in  the  command line,  the  LDraw  object
  150. "light.dat" will be converted to a light source. Currently the color of the
  151. object is not converted,  l2p just will create a white light.  This will be
  152. changed in future  probably.  If this option is not given,  the "light.dat"
  153. objects will not be converted.
  154.   New in version 0.51 is the conversion of the  LDraw object "spotlite.dat"
  155. to directed Light sources. These Lightsources emit a cone of light into the
  156. direction of the arrow, but these lights are not as bright as normal light-
  157. sources,  so I think a scene  just with directed  lights will be to dark in
  158. any case. 
  159.  
  160.  
  161. 2.2.3. -t command line switch
  162.  
  163.   The "-t" or "-T" switch will generate a table which lists the LDraw parts
  164. converted by l2p:
  165.  
  166.   Used parts in quantity:
  167.    Part        Part        Part        Part        Part
  168.      28:  11    101:  12    148:  11   2431:   2   2445:   9
  169.    3001:   2
  170.  
  171.   If more  steps of a model is converted (see -s command line switch), the
  172. table contains the quantities of the last generated step.
  173.  
  174.  
  175. 2.2.4. -v command line switch
  176.  
  177.   If "-v" or "-V" is given as an option, l2p will print some general
  178. informations about the conversion, as shown below:
  179.  
  180.   Converting mymodel.dat to mymodel.pov.
  181.   Generating each step.
  182.   Total Number of Steps:  1
  183.   Total Number of Parts:  36
  184.   Total Number of Lights: 0
  185.  
  186.  
  187. 2.2.5. -m command line switch
  188.  
  189.   This option lets l2p print a (unsorted) list of the parts used in your
  190. model, which are not in LGEO now. I fear this to be a shot in my knee, as
  191. people now will mail me for needing this one special part...
  192.  
  193.  
  194. 2.2.6. -s[n] command line switch
  195.  
  196.   With  the "-s" or "-S" option  specified,  l2p will generate each step of
  197. the models as a single file instead of the complete  model in one file. The
  198. step number will be appended to the destination file name.
  199.   If an additional integer is specified, e.g. "-s4", only this step will be
  200. generated. All parts used until the specified step (inclusive) will be con-
  201. verted. 
  202.  
  203.  
  204. 2.2.7. -f command line switch
  205.  
  206.   When specifying the "-f" or "-F" switch, l2p generates a full scene ready
  207. to render,  with a camera about the  standard LDraw viewing  angle and some
  208. general lights.  Do not use  this option on submodels,  since then you will
  209. have multiple camera setups.
  210.   When generating such a full scene,  you also cannot forget to include the
  211. "lg_defs.inc" and "lg_color.inc" files,  which seems to  be a common source
  212. of errors.  The camera  position is calculated by  using the maximum ranges
  213. of parts locations,  not including the size of the parts, so it is somewhat
  214. imperfect.  If you do not like the setup,  just use a text editor to change
  215. the location and look_at of the camera in the generated files.
  216.   Not that since this  is a full scene,  the maybe specified "-i" switch to
  217. generate a "*.inc" instead  of a "*.pov" file  will be overridden,  so when
  218. "-f" is specifid you always will get a "*.pov" file.
  219.  
  220.  
  221. 2.3. Colors
  222.  
  223.   The colors from LDraw are converted as shown in the list below. Any other
  224. color number not listed will be converted to a color called "lg_undefined".
  225. This is a light  blue with no LEGO(tm) equivalent,  so it should be easy to
  226. detect parts with incorrect colors in your traced picture.  Color number 16
  227. will not be textured at all, to work with the submodel feature (New for l2p
  228. v0.2).
  229.  
  230.   LDraw Color  LEGO(tm) Color
  231.     0          black
  232.     1          blue 
  233.     2          green
  234.     4          red
  235.     5          purple (dark violet, as in Technic set 8277)
  236.     6          brown
  237.     7          gray 
  238.     8          dark gray
  239.    13          pink (e.g. in Belville)
  240.    14          yellow
  241.    15          white
  242.    33          clear blue
  243.    34          clear green
  244.    36          clear red
  245.    42          clear neon green (fluorescent yellow)
  246.    43          clear cyan
  247.    44          clear neon orange (fluorescent orange)
  248.    46          clear yellow
  249.    47          clear white (colorless)
  250.   334          gold (reflecting)
  251.   382          tan (beige, desert)
  252.   434          dark cyan (e.g. in New Technic Models)
  253.   503          chrome (reflecting)
  254.   506          mint (e.g. in Belville)
  255.   509          rose (e.g. in Paradisa)
  256.   510          light yellow (e.g. in Belville)
  257.  
  258.  
  259. 2.4. Parts
  260.  
  261.   The parts  defined in the lgeo  library for POV-Ray have the same name as
  262. the LDraw parts, with a "lg_" prefix.  They also have the same orientation,
  263. but with a  different unit size.  The scaling is done by L2P.  Just look at
  264. the LGEO directory  to see which parts will be acknowledged by L2P.  If you
  265. have the  latest version  of the  "l2p_elmt.tab" file,  they  should all be
  266. known to L2P.
  267.  
  268.  
  269. 2.5. Error handling
  270.  
  271. 2.5.1. "Cannot open file <l2p_colr.tab>" and
  272.        "Cannot open file <l2p_elmt.tab>" and
  273.        "Cannot open file <l2p_ptrn.tab>"
  274.  
  275.   One  of the  convert table  files could not be found.  Make sure they are
  276. present in the directory you are working in.
  277.  
  278.  
  279. 2.5.2. "Cannot open Input file ..."
  280.  
  281.   The specified input file could not be opened. Check path and filename.
  282.  
  283.  
  284. 2.5.3. "Cannot open Output file"
  285.  
  286.   The current output file could not  be opened.  It may be existant and pro-
  287. tected or the disk may be full. 
  288.  
  289.  
  290. 2.5.4. "Could not allocate memory for ..."
  291.  
  292.   This may occur  for any  allocations to be made.  Building the converting
  293. tables from  the convert table  files or reading the input file.  Free some
  294. memory and try again.  The memory  needed for one part  from the conversion
  295. table is  a maximum of 32 bytes,  depending on the name of  the part,  each
  296. part from the  input file needs 68 bytes.  The color table needs about 600
  297. bytes maximum.  
  298.  
  299.  
  300. 3. Future plans
  301.  
  302.   What I want to implement for the future:
  303.  
  304.   Colored lights
  305.  
  306.     The color of a light  element will be translated  into a  colored light
  307.   source for POV-Ray. 
  308.  
  309.   Convert Steps without previous parts
  310.  
  311.     This  option will  only generate  the POV-Ray scene  file containig the
  312.   parts in the  current step,  not all elements  upto this step, as it does
  313.   now.
  314.  
  315.  
  316. 4. The closing
  317.  
  318.   Feel free to  contact me for any reason about l2p.  If you have some bugs
  319. detected, describe them as exact as possible. If neccessary, send me a copy
  320. of the LDraw file causing the error. 
  321.   Suggestions are welcome too. Also are donations.
  322.  
  323.   You can contact me by e-mail:
  324.  
  325.   Chaotix@T-Online.de
  326.  
  327.   Or take a look at my Homepage for latest news on L2P/LGEO:
  328.  
  329.   http://titan.informatik.uni-bonn.de/%7Euhlmann/
  330.  
  331.  
  332. Have fun,
  333.  
  334.      Lutz
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.